﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PlotDesigner
{
    public partial class DialogEditor : Form
    {
        DialogNode dlgNode;
        public DialogEditor(DialogNode dn)
        {
            dlgNode = dn;
            InitializeComponent();
        }

        private void DialogEditor_Load(object sender, EventArgs e)
        {
            textBox_speaker.Text = dlgNode.Speaker;
            if(dlgNode.DlgRtf == "")
            {
                richTextBox_value.Text = dlgNode.DlgValue;
            }
            else
            {
                richTextBox_value.Rtf = dlgNode.DlgRtf;
            }
            this.Text = string.Format("剧情\"{0}\"", dlgNode.fa.plotName) + string.Format("的第{0}个对话", (dlgNode.getIndex() + 1).ToString());
        }

        private void OkClick(object sender, EventArgs e)
        {
            dlgNode.Speaker = textBox_speaker.Text;
            dlgNode.DlgValue = richTextBox_value.Text;
            dlgNode.DlgRtf = richTextBox_value.Rtf;
            this.Close();
        }
    }
}
